﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using InventoryPro.BL;
using InventoryPro.DAL;

namespace InventryPro.Products
{
    public partial class SaveProduct : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                ProductLogic logic = new ProductLogic();
                Product product = logic.GetProductbyID(1);
                //this.ObjProduct. = .new[] { product };
                ProductFV.DataSource = new[] {product};
               
                ProductFV.DataBind();
                ProductFV.ChangeMode(FormViewMode.ReadOnly);
            }
        }


        protected void ProductFV_ItemCommand(object sender, FormViewCommandEventArgs e)
        {
            //switch (e.CommandName)
            //{

            //    case "UpdateInfo":
            //        UpdateClub();
            //        ProductFV.ChangeMode(FormViewMode.ReadOnly);
            //        gvClubList.DataSource = ClubList.dt;
            //        gvClubList.DataBind();
            //        break;
            //    case "SubmitInfo":
            //        AddClub();
            //        ProductFV.ChangeMode(FormViewMode.ReadOnly);
            //        gvClubList.DataSource = ClubList.dt;
            //        gvClubList.DataBind();
            //        break;
            //    case "CancelUpdate":
            //        ProductFV.ChangeMode(FormViewMode.ReadOnly);
            //        break;
            //    case "CancelInsert":
            //        ProductFV.ChangeMode(FormViewMode.ReadOnly);
            //        break;
            //    default:
            //        break;
            //}
            // FOR THE MODE TO CHANGE CALL DATA BIND.
            ProductFV.DataBind();

        }

    }
}